package xyPicture;

import com.oracle.tools.packager.IOUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

@WebServlet("/ServletDemo2")
public class ServletDemo2 extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //相对路径获取绝对路径
       // String realPath = getServletContext().getRealPath("/img/hm.png");
        InputStream resourceAsStream = getServletContext().getResourceAsStream("/img/nm.png");
         //BufferedInputStream bis = new BufferedInputStream(new FileInputStream(realPath));
        //org.apache.commons.io.IOUtils.copy();
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}
